package top.itaso.app.ui.progressbar;

/**
 * @Description:
 * @Author itsdf07
 * @E-Mail 923255742@qq.com
 * @Gitee https://gitee.com/itsdf07
 * @Date 2022/4/5
 */
public class DownloadFileBean {
    /**
     * 文件的当前操作状态
     */
    public enum EFileState {
        NORMAL,//常态：即开始前
        STARTING,//进行中
        PAUSING,//暂停中
        STOPED,//已停止，表示未完成
        FINISH//结束，表示已完成
    }

    /**
     * 文件总大小，单位：字节（B）
     */
    private long fileSize;
    /**
     * 当前已下载大小：单位：字节（B）
     */
    private long downloadSize;
    /**
     * 当前下载速度
     */
    private long downloadSpeed;

    /**
     * 当前已下载的百分比
     */
    private int hasDownloadPercentValue;

    /**
     * 文件存储路径
     */
    private String savePath;

    /**
     * 文件相关描述
     */
    private String fileDesc;

    /**
     * 文件下载地址
     */
    private String url = "/sdcard/Android/data/file/update.zip";

    /**
     * 当前文件状态{@link EFileState}
     */
    private EFileState fileState;

    public long getFileSize() {
        return fileSize;
    }

    public void setFileSize(long fileSize) {
        this.fileSize = fileSize;
    }

    public long getDownloadSize() {
        return downloadSize;
    }

    public void setDownloadSize(long downloadSize) {
        this.downloadSize = downloadSize;
    }

    public long getDownloadSpeed() {
        return downloadSpeed;
    }

    public void setDownloadSpeed(long downloadSpeed) {
        this.downloadSpeed = downloadSpeed;
    }

    public String getSavePath() {
        return savePath;
    }

    public void setSavePath(String savePath) {
        this.savePath = savePath;
    }

    public String getFileDesc() {
        return fileDesc;
    }

    public void setFileDesc(String fileDesc) {
        this.fileDesc = fileDesc;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public EFileState getFileState() {
        return fileState;
    }

    public void setFileState(EFileState fileState) {
        this.fileState = fileState;
    }

    public int getHasDownloadPercentValue() {
        hasDownloadPercentValue = (int) (downloadSize * 100 / fileSize);
        return hasDownloadPercentValue;
    }

}
